package com.sauro.study.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class SpringMVCConfig implements WebMvcConfigurer {


    @Bean
    public ProjectRequestInterceptor projectRequestInterceptor() {
        return new ProjectRequestInterceptor();
    }


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(projectRequestInterceptor())
                .addPathPatterns("/**");
//                .excludePathPatterns("/test/post/add");
        WebMvcConfigurer.super.addInterceptors(registry);
    }
}
